package com.itheima03;

public class FlyableDemo {
    public static void main(String[] args) {
        //
        Flyable flyable = new Flyablelmpl();
        useFlyable(flyable);

        // 匿名内部类改进
        useFlyable(new Flyable() {
            @Override
            public void fly(String a) {
                System.out.println(a + "飞起来了");
            }
        });

        // Lambda 表达式改进
        useFlyable((String a) -> {
            System.out.println(a + "飞起来了");
        });
    }

    private static void useFlyable(Flyable a) {
        a.fly("小鸟");
    }
}
